import time

def bt(ns):
    sd = True
    while sd:
        sd = False
        for i in range(len(ns) - 1):
            if ns[i] > ns[i + 1]:
                ns[i], ns[i + 1] = ns[i + 1], ns[i]
                sd = True

def rt(fe):
    file = open(fe, 'r')
    data = file.readlines()
    return data

f1 = rt("f1_sorted.txt")
f2 = rt("f2_reverse.txt")
f3 = rt("f3_shuffle.txt")

t_start = time.time()
bt(f1)
t_finish = time.time()
print("f1_sorted",round((t_finish-t_start)*1000),"milliseconds")

t_start = time.time()
bt(f2)
t_finish = time.time()
print("f2_reverse",round((t_finish-t_start)*1000),"milliseconds")

t_start = time.time()
bt(f3)
t_finish = time.time()
print("f3_shuffle",round((t_finish-t_start)*1000),"milliseconds")
